import Sequelize = require('sequelize')
const service = require('feathers-sequelize')

//约定:表名同该文件名
const lastSlashIndex = __filename.lastIndexOf("/")
const lastDotIndex = __filename.lastIndexOf(".")
const tableName = 'tb_' + 'push_target'

const fields = {
    id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        primaryKey: true,
        autoIncrement: true,
    },
    push_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
    },
    wholesaler_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
    },
    role: {
        type: Sequelize.BOOLEAN,
        allowNull: false,
    },
    update_time: {
        type: Sequelize.BIGINT,
        allowNull: false,
    },
}

const classMethods = {
    associate(models: any[]) {

    }
}

export = function (sequelize: Sequelize.Sequelize) {
    let options = {
        tableName,
        classMethods
    }
    let Model = sequelize.define(tableName, fields, options)
    return Model
}